﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Query;
using Protocal.App.Common.Models;

namespace 多协议通信平台.IService
{
    public interface IBaseService
    {
        public T SelectOne<T>(Expression<Func<T, bool>> condition) where T : class;

        public List<T> SelectList<T>(Expression<Func<T, bool>> condition) where T : class;

        public PageResult<T> SelectPage<T, S>(Expression<Func<T, bool>> condition, int pageIndex, int pageSize, Expression<Func<T, S>> orderbyfield, bool isAsc = true) where T : class;

        public T Insert<T>(T entity) where T : class;

        public int InsertRange<T>(IEnumerable<T> entities) where T : class;

        public void Update<T>(T entity) where T : class;

        public int UpdateRange<T>(IEnumerable<T> entities) where T : class;

        public int UpdateRange<T>(Expression<Func<T, bool>> condition, Expression<Func<SetPropertyCalls<T>, SetPropertyCalls<T>>> setPropertyCalls) where T : class;

        public void Delete<T>(T entity) where T : class;

        public int DeleteRange<T>(IEnumerable<T> entities) where T : class;

        public int DeleteRange<T>(Expression<Func<T, bool>> condition) where T : class;
    }
}
